package test.mp.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import test.mp.domain.po.User;

import java.util.List;

/**
 * @ClassName UserMapper
 * @Description wxx
 * @Author wxx
 * @Date 2024/08/04/12:05
 * @Version 1.0
 */
public interface UserMapper extends BaseMapper<User> {

    void deleteUser(String id);

    void updateUser(User user);

    User queryUserById(@Param("id") String id);

    List<User> queryUserByIds(@Param("ids") List<String> ids);


    // 必须是ew
    void updateBalanceByIds(@Param(Constants.WRAPPER) QueryWrapper<User> queryWrapper, @Param("amount") int amount);

    @Update("update user_mp set balance = balance - #{money} where id = #{id}")
    void deductBalance(@Param("id")String id, @Param("money") Integer money);
}
